package com.hex.ds.hdtp.core.app.data.table.converter;

import com.hex.ds.hdtp.core.app.data.table.dto.request.TableTransferListRequestDto;
import com.hex.ds.hdtp.core.app.data.table.dto.request.TableTransferRunLogRequestDto;
import com.hex.ds.hdtp.core.app.data.table.dto.response.TableTransferListResponseDto;
import com.hex.ds.hdtp.core.inf.data.table.po.TableTransferListPo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

/**
 * @Package com.hex.ds.hdtp.core.app.data.table.converter
 * @ClassName ITableTransferListConverter
 * @Description 表迁移清单-DTO对象转PO对象转换器
 * @Author Wang zhihao
 * @Date 2023/8/9 11:33
 * @Version v1.0
 **/
@Mapper(componentModel = "spring")
public interface ITableTransferListConverter {

    /**
     * @Method toTableTransferListPo
     * @Param
     * @param tableTransferListRequestDto
     * @Return com.hex.ds.hdtp.core.inf.data.table.po.TableTransferListPo
     * @Description RequestDto对象转Po对象
     * @Author Wang zhihao
     * @Date 2023/8/9 11:33
     * @Version V1.0
     */
    TableTransferListPo toTableTransferListPo(TableTransferListRequestDto tableTransferListRequestDto);

    /**
     * @Method toTableTransferListResponseDtoList
     * @Param
     * @param tableTransferListPos
     * @Return java.util.List<com.hex.ds.hdtp.core.app.data.table.dto.response.TableTransferListResponseDto>
     * @Description PO对象集合转换ResponseDto对象集合
     * @Author Wang zhihao
     * @Date 2023/8/9 11:33
     * @Version V1.0
     */
    List<TableTransferListResponseDto> toTableTransferListResponseDtoList(List<TableTransferListPo> tableTransferListPos);

    /**
     * @Method toTableTransferListResponseDto
     * @Param
     * @param tableTransferListPo
     * @Return com.hex.ds.hdtp.core.app.data.table.dto.response.TableTransferListResponseDto
     * @Description PO对象转换ResponseDto对象
     * @Author Wang zhihao
     * @Date 2023/8/10 19:58
     * @Version V1.0
     */
    TableTransferListResponseDto toTableTransferListResponseDto(TableTransferListPo tableTransferListPo);

    /**
     * @Method toTableTransferRunLog
     * @Param
     * @Return com.hex.ds.hdtp.core.app.data.table.dto.request.TableTransferRunLogRequestDto
     * @Description 清单信息转为建表记录信息
     * @Author Wang zhihao
     * @Date 2023/8/13 22:57
     * @Version V1.0
     */
    @Mapping(target = "listPkId", source = "tableTransferListResponseDto.pkId")
    @Mapping(target = "databaseName", source = "tableTransferListResponseDto.targetDbName")
    @Mapping(target = "tableName", source = "tableTransferListResponseDto.targetTableName")
    @Mapping(target = "createSql", source = "tableTransferListResponseDto.targetCreateSql")
    @Mapping(target = "message", source = "message")
    TableTransferRunLogRequestDto toTableTransferRunLog(TableTransferListResponseDto tableTransferListResponseDto, String message);

    /**
     * @Method toTableTransferListRequestDto
     * @Param
     * @param tableTransferListResponseDto
     * @Return com.hex.ds.hdtp.core.app.data.table.dto.request.TableTransferListRequestDto
     * @Description 建表清单的Response对象转为Request对象
     * @Author Wang zhihao
     * @Date 2023/8/21 17:08
     * @Version V1.0
     */
    TableTransferListRequestDto toTableTransferListRequestDto(TableTransferListResponseDto tableTransferListResponseDto);
}
